package com.example.homework.homework01;

// 银卡
public class SilverCard extends Card {

    public SilverCard(String id, double balance) {
        super(id, balance);
    }

    @Override
    public void pay(double money) {
        // 1.先输出当前的消费信息
        System.out.println("欢迎使用银卡支付！当前卡号是" + getId());
        System.out.println("您当前银卡的消费：" + money);
        System.out.println("优惠后的价格：" + money * 0.85);

        // 2.判断余额是否足够
        if (getBalance() < money * 0.85) {
            System.out.println("您余额是：" + getBalance() + ", 当前余额不足！请存钱！");
            return; // 干掉方法！
        }

        // 3.更新银卡的余额
        setBalance(getBalance() - money * 0.85);
        System.out.println("您当前银卡余额：" + getBalance());
    }
}
